Conversation
…tance event (Windows, Linux)
…l launch Cyd on a cyd:// URL
…the Windows situation
|
Oh also, the reason it's requiring the hostname to be |
Co-authored-by: Saptak Sengupta <saptak013@gmail.com>
…-oath-callback (and their cyd-dev equivalents)
…d into 370-protocol-handler
|
@SaptakS I've pushed a few more commits that do the following: I updated I also updated
|
|
Went through the code and left my thoughts. I will start testing it out in the OS. |
|
✅ Tested on macOS, with Cyd both Open and Closed |
|
SaptakS
left a comment
There was a problem hiding this comment.
Based on my testing in fedora and windows and @redshiftzero testing on MacOS, I am going to approve this PR.
This fixes #370.
In prod mode, it registers the
cyd://protocol, and in all other modes it registers thecyd-dev://protocol. In case it helps with review, here's a docs that explain how this is supposed to work. Note that there's differences between how macOS works and how Windows/Linux works.While this may change, right now the hostname needs to be
social.cyd.apiorsocial.cyd.dev-api. Here are how various URLs should behave:cyd-dev://asdf/<-- should open/focus Cyd Dev and pop up a dialog saying the hostname is invalidcyd-dev://social.cyd.dev-api/<-- should open/focus Cyd Dev, and that's itcyd-dev//social.cyd.dev-api/anything-else-here<-- should open/focus Cyd Dev and pop up a dialog saying it's an invalid pathWhen testing in each platform, you need to actually build the installer and then install it, and then test on that final installed version. We need to test these URLs in these two cases:
I think this should work in all cases except for Windows, when Cyd Dev is closed. For some reason it's not opening in that case, and I can't quite figure out why. So while you're reviewing this PR, any ideas would be appreciated (or if you aren't reproducing the problem I think I'm seeing that would be cool too).
This PR also changes how logging works. Before it never logged to file and only to the console. Now, in prod mode it only logs to the console, but in all other modes it logs to disk. You can find the logs here:
~/Library/Logs/Cyd Dev/main.log~/.config/Cyd Dev/logs/main.log%USERPROFILE%\AppData\Roaming\Cyd Dev\logs\main.logBy tailing these files, you can tell when a new Cyd process launches and also you should be able to see the URLs that get passed in.
The way I've implemented it, if the app has not been initialized yet, it adds Cyd URLs to a queue instead of just processing them. Once the app is initialized, it processes everything in the queue. This is required to make Cyd URLs pop up dialog boxes, because that requires the app to be initialized.
Testing in macOS
Make a build:
Eventually you'll get to a "Preparing to notarize macOS artifacts" step and you can press Ctrl-C to quit it early. Then, there will be a DMG in
out/make/. Open it and drag "Cyd Dev" to Applications, and open it once -- this should register itself as acyd-devhandler.To test URLs:
Test with both Cyd Dev closed and open.
Testing in Linux
Make a build (check this Dockerfile for what linux deps you need installed -- I've had an easier time building both RPM and DEB from Debian rather than from Fedora):
This will make a DEB in
out/make/deb/and an RPM inout/make/rpm/.Install the DEB and/or the RPM. I've only tested .deb myself so far, but .rpm should be the same, though it might not. One reason it's important to test the DEB and RPM separately is the build process makes their
.desktopfiles, and this file needs to be properly created to handle new protocols.To test URLs:
After installing, test with both Cyd Dev closed and open.
Testing in Windows
Make a build:
This will create an EXE installer in
out/make/squirrel.windows/{arch}/. Double click it to install.To test URL, press Windows-R, type the URL like
cyd-dev://asdf/, and press enter.After installing, test with both Cyd Dev closed and open.
In my testing, if I'm tailing the logs (which I do in Git Bash since PowerShell doesn't have
tail, and my Windows VM doesn't have WSL) and Cyd Dev is already open in Windows, it success in processing thecyd-dev://URL. But if I completely close Cyd Dev and then try it, it just doesn't seem to do anything -- I can tell that it's not launching a new Cyd process because the logs don't print anything. I don't know why, so this needs to be fixed before it's ready to merge.